#!/usr/bin/env zsh

emulate -L zsh -o err_return
setopt no_unset extended_glob typeset_silent no_multi_byte \
       prompt_percent no_prompt_subst warn_create_global pipe_fail

() {

local -r user=zsh-bench
local -r root_dir=${ZSH_SCRIPT:A:h:h}

zmodload zsh/zutil

local -a flags config_dir=(_ $root_dir/configs)
zparseopts -D -K -F -a flags -- \
  {c,-config-dir}:=config_dir   \
  {s,-standalone}               \
  {l,-login}:                   \
  {r,-raw}:                     \
  {d,-scratch-dir}:             \
  {i,-iters}:                   \
  {g,-git}:

local cfg
for cfg; do
  $root_dir/internal/install-config \
    zsh-bench 0 $config_dir[2] $cfg '~/zsh-bench/zsh-bench '${(j: :)${(@qqq)flags}}
done

} "$@"
